package de.ba_rm.java.password.checker;

import java.lang.Thread.UncaughtExceptionHandler;

import javax.swing.SwingUtilities;

import org.jdesktop.swingx.JXErrorPane;
import org.jdesktop.swingx.error.ErrorInfo;

/**
 * Hauptklasse und -einstiegspunkt der Anwendung.
 * 
 * @author sebastian.toense@gmail.com
 *
 */
public class App implements UncaughtExceptionHandler {

	/**
	 * Einstiegspunkt.
	 * @param args <i>nicht genutzt</i>
	 */
	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler(new App());
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				new Controller();
			}
		});
	}

	@Override
	public void uncaughtException(Thread t, Throwable e) {
		final ErrorInfo info = new ErrorInfo(Messages.getString("View.17"), e.getLocalizedMessage(), null, null, e, null, null);
		JXErrorPane.showDialog(null, info);
	}
}
